Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw4 #94

Open
wants to merge 2 commits into
base: RMulyukov/main
Choose a base branch
from
Open

hw4 #94

wants to merge 2 commits into from

Conversation

Rustyam
Copy link

@Rustyam Rustyam commented Feb 17, 2024

No description provided.


private function initSuccess(): void
{
header("HTTP/1.1 200 OK");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сайд эффект. Заголовок сразу выставится и потом мы не сможем поменять, что может привести к неожиданным проблемам.

private function initSuccess(): void
{
header("HTTP/1.1 200 OK");
$this->message = 'OK';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем нам тут устанавливать внутреннее значения сообщения?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в задании написано
• если строка корректна, то пользователю возвращается ответ 200 OK, с информационным текстом, что всё хорошо;
• если строка некорректна, то пользователю возвращается ответ 400 Bad Request, с информационным текстом, что всё плохо.

$this->message содержит этот информационный текст

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вопрос в том, что тут мы устанавливаем заголовок и записываем значение в message, чтобы потом его получить и напечатать. Не будет ли лучше сразу напечатать и всё?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants